<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;

use Illuminate\Database\Eloquent\Model;

class Gift extends Model
{
	use HasDateTimeFormatter;

    const CREATED_AT = 'created_at';

    const UPDATED_AT = null;

    protected $fillable = [
        'user_id',
        'amount',
        'type',
        'income_user_id',
        'giftable_id',
        'giftable_type',
        'order_no',
        'user_income',
        'parent_id',
        'direct_distribution_income',
        'grand_id',
        'interposition_income',
        'status',
        'platform',
        'pay_method'
    ];

    protected $attributes = [
        'status' => 0,
        'parent_id' => 0,
        'direct_distribution_income' => 0,
        'grand_id' => 0,
        'interposition_income' => 0
    ];


   public function user()
   {
       return $this->belongsTo(User::class,'user_id');
   }

   public function auth()
   {
       return $this->belongsTo(UserAuth::class,'user_id','user_id');
   }

   public function income()
   {
       return $this->belongsTo(User::class,'income_user_id','id');
   }
}
